.TH std::basic_stacktrace::size 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_stacktrace::size \- std::basic_stacktrace::size

.SH Synopsis
   size_type size() const noexcept;  (since C++23)

   Returns the number of entries in the stacktrace.

.SH Parameters

   \fI(none)\fP

.SH Return value

   The number of entries in the stacktrace.

.SH Complexity

   Constant.

.SH Example

   The following code uses size to display the number of entries in the current
   stacktrace:


// Run this code

 #include <stacktrace>
 #include <iostream>

 int main()
 {
     auto trace = std::stacktrace::current();

     std::cout << "trace contains " << trace.size() << " entries.\\n";
 }

.SH Possible output:

 trace contains 3 entries.

.SH See also

   empty    checks whether the basic_stacktrace is empty
            \fI(public member function)\fP
   max_size returns the maximum possible number of stacktrace entries
            \fI(public member function)\fP
